package com.company.笔试.FIFO页面置换;// 本题为考试多行输入输出规范示例，无需提交，不计分。
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main {
    public static void print() {
        System.out.println("123");
    }

    public static void main(String[] args) {
        int a =  Integer.valueOf("98");

        ((Main) null).print();
        Scanner sc = new Scanner(System.in);
        int size = sc.nextInt(); //2
        int n = sc.nextInt();   //5
        int ans = 0, x;
        Queue<Integer> queue = new LinkedList<>();
        for(int i = 0; i < n; i++){
            x = sc.nextInt();
            if (queue.contains(x)) continue;
            if (queue.size()<size){
                queue.add(x);
                ans += 1;
            }else {
                queue.poll();
                queue.add(x);
                ans += 1;
            }

        }
        /*
* 2 5
9 6 3 6 9*/
        System.out.println(ans);
    }
}